package com.aps.entity.dto;

import java.math.BigDecimal;

import com.aps.entity.domain.device.DeviceModule;
import com.aps.entity.domain.device.DeviceSpec;

import lombok.Data;

/**
 * @author liaoguangan
 * @description <>
 * @date 2018/4/4 13:29
 */
@Data
public class DeviceModuleJpaDTO {

    private String code;
    private String name;
    private String deviceSpecCode;
    private String deviceCode;

    private String specCode;
    private BigDecimal length;
    private BigDecimal width;
    private BigDecimal volume;

    private String deviceTypeCode;

    public DeviceModuleDTO build() {
        DeviceModuleDTO dmd = new DeviceModuleDTO();

        DeviceModule dm = new DeviceModule();
        dm.setCode(this.getCode());
        dm.setName(this.getName());
        dm.setDeviceSpecCode(this.getDeviceSpecCode());
        dm.setDeviceCode(this.getDeviceCode());

        DeviceSpec deviceSpec = new DeviceSpec();
        deviceSpec.setCode(this.getSpecCode());
        deviceSpec.setLength(this.getLength());
        deviceSpec.setWidth(this.getWidth());
        deviceSpec.setVolume(this.getVolume());

        dmd.setDeviceModule(dm);
        dmd.setDeviceSpec(deviceSpec);
        dmd.setDeviceTypeCode(this.getDeviceTypeCode());

        return dmd;
    }
}
